package com.xy.yunduo.web.controller;

import com.github.pagehelper.PageInfo;
import com.xy.yunduo.api.test.ITestService;
import com.xy.yunduo.server.pojo.test.TestModel;
import com.xy.yunduo.utils.response.ApiPagerResponse;
import com.xy.yunduo.utils.response.ApiResponse;
import com.xy.yunduo.utils.response.ServerResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/api/test")
public class TestController {

    @Autowired
    private ITestService testService;

    @RequestMapping(value = "/all", method = RequestMethod.GET)
    @ResponseBody
    public ApiPagerResponse<TestModel> all(int page, int row) {
        PageInfo<TestModel> rst= testService.getTestList(page,row);

       return ServerResponseUtil.replySuccess(rst.getTotal(),rst.getList());
    }
}
